package com.shop.web;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.shop.entity.Order;
import com.shop.entity.OrderDetail;
import com.shop.entity.Product;
import com.shop.service.OrderDetailService;
import com.shop.service.OrderService;

public class OrderAction extends ActionSupport{
	private Order order ;//订单
	private OrderDetail orderDetail ;//订单详情
	
	@Autowired
	private OrderService orderService ;
	@Autowired
	private OrderDetailService orderDetailService;
	
	static List<Product> plist = new ArrayList<Product>();
	public String joinCar(){
		System.out.println("///////////=="+product.getEpId());
		Product productDetail = productService.selectProduct(product);
		plist.add(productDetail);
		

		ActionContext.getContext().put("plist",plist);
		System.out.println("=============++"+plist.size());
		return "buy";
	}
	public String addOrder(){
		Serializable seorder = orderService.addOrder(order);
		Serializable seorderDetail =orderDetailService.addOrderDetail(orderDetail);
		
		return INPUT;
	}
	
	
	
	
	
	
	
	
	
	
	public OrderDetailService getOrderDetailService() {
		return orderDetailService;
	}

	public void setOrderDetailService(OrderDetailService orderDetailService) {
		this.orderDetailService = orderDetailService;
	}

	public Order getOrder() {
		return order;
	}

	public void setOrder(Order order) {
		this.order = order;
	}

	public OrderDetail getOrderDetail() {
		return orderDetail;
	}

	public void setOrderDetail(OrderDetail orderDetail) {
		this.orderDetail = orderDetail;
	}

	public OrderService getOrderService() {
		return orderService;
	}

	public void setOrderService(OrderService orderService) {
		this.orderService = orderService;
	}
	
	
	
	
	

}
